/*
 * Shanghai Buyan Technology Development Co., Ltd
 * Web Site: http://www.buyantech.com
 * Since 2011 - 2012
 */package com.buyantech.smweb.dao;

import javacommon.base.*;
import cn.org.rapid_framework.page.*;
import com.buyantech.smweb.model.*;
import com.buyantech.smweb.vo.query.*;
import com.opensymphony.oscache.util.StringUtil;

/**
 * @author Albert email:albert(a)buyantech.com
 * @version 1.0
 * @date 2012-05-10
 */


import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Repository;

@Repository
public class BlackDao extends BaseHibernateDao<Black,java.lang.String>{

	@Override
	public Class getEntityClass() {
		return Black.class;
	}
	
	public Page findPage(BlackQuery query) {
		String sql = "select t from Black t where 1=1 "
			  	+ "/~ and t.crdate = {crdate} ~/"
				+ "/~ order by [sortColumns] ~/";

        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
		return pageQuery(sql,query);
	}

	public Page searchPage(BlackQuery query) {
        //XsqlBuilder syntax,please see http://code.google.com/p/rapid-xsqlbuilder
        // [column]为字符串拼接, {column}为使用占位符. [column]为使用字符串拼接,如username='[username]',偷懒时可以使用字符串拼接 
        // [column] 为PageRequest的属性
		String sql = "select t from Black t where 1=1 "
				+ "/~ and t.account like '%[account]%' ~/"
				+ "/~ order by [sortColumns] ~/";
        //生成sql2的原因是为了不喜欢使用xsqlbuilder的同学，请修改生成器模板，删除本段的生成
		return pageQuery(sql,query);
	}
	

}
